home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Headers / misckit / MiscDocument.h < prev    next >
Encoding:
Text File  |  1995-01-27  |  3.2 KB  |  115 lines

  1. //
  2. //    MiscDocument.h -- document controller
  3. //        Written by Mike Ferris Copyright (c) 1993, 1995 by Mike Ferris.
  4. //        Modified for use in the MiscKit by Don Yacktman from MODocController.
  5. //                Version 1.0.  All rights reserved.
  6. //        This notice may not be removed from this source code.
  7. //
  8. //    This object is included in the MiscKit by permission from the author
  9. //    and its use is governed by the MiscKit license, found in the file
  10. //    "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  11. //    for a list of all applicable permissions and restrictions.
  12. //    
  13.  
  14. // ABOUT MiscDocument
  15. //
  16. // MiscDocument is a subclass of MiscNibController which adds file
  17. // support.  Each MiscDocument has a window (inherited from
  18. // MiscNibController) and a file to save the window in.  Documents can
  19. // be untitled (no file yet).  Documents need not have windows.  Documents
  20. // can be managed by a MiscDocManager.
  21. //
  22. // By itself, a subclass of MiscDocument can keep track of whether
  23. // it is untitled or has a file.  It can perform all the standard file 
  24. // operations new, open, save, revert, save as, and save to, if several
  25. // methods are provided in the subclass.  It will also alert the user 
  26. // if it is dirty and they try to close it allowing them to save and 
  27. // close, close without saving or cancel the close.
  28. //
  29. // With a MiscDocManager subclass it will uniquely number untitled
  30. // documents and stagger windows.  As well as other things documented
  31. // in the MiscDocManager class header.
  32.  
  33. #import <misckit/MiscNibController.h>
  34.  
  35. // Forward declarations of class names we'll use for static typing.
  36. @class MiscString;
  37. @class MiscDocManager;
  38. @class MiscDocType;
  39.  
  40. @interface MiscDocument:MiscNibController
  41. {
  42.     MiscDocManager *manager;
  43.     MiscString *docName;
  44.     MiscString *untitledString;
  45.     MiscDocType *docType;
  46.     BOOL isDirty;
  47.  
  48.     // save panel popup accessory outlets
  49.     id    saveAccessoryPanel;
  50.     id    saveAccessoryBox;
  51.     id    saveAccessoryPopupButton;
  52. }
  53.  
  54. + initialize;
  55.  
  56. + setControllerName:(const char *)typeName;
  57. + (MiscString *)controllerName;
  58.  
  59. + addDocType:(int)tag name:(const char *)name extension:(const char *)ext 
  60.             openSelector:(SEL)openSel saveSelector:(SEL)saveSel;
  61. + (List *)docTypes;
  62. + (MiscDocType *)docTypeForTag:(int)tag;
  63. + (MiscDocType *)docTypeForName:(const char *)name;
  64. + (MiscDocType *)docTypeForExtension:(const char *)extension;
  65. + (List *)getOpenTypesList:(List *)list;
  66. + (List *)getSaveTypesList:(List *)list;
  67.  
  68. + startUnloading;
  69.  
  70. - initFromFile:(const char *)path manager:aManager;
  71. - initWithFrameName:(const char *)theFrameName;
  72. - initWithFrameName:(const char *)theFrameName 
  73.             fromFile:(const char *)path manager:aManager;
  74. - free;
  75.  
  76. - nibDidLoad;
  77.  
  78. - (BOOL)doClear;
  79. - (BOOL)doPrint;
  80.  
  81. - saveAccessoryPopupAction:sender;
  82. - getSaveAccessoryForSaveTypes:(List *)saveTypes 
  83.             currentType:(MiscDocType *)currentType;
  84.  
  85. - save:sender;
  86. - saveAs:sender;
  87. - saveTo:sender;
  88. - revert:sender;
  89. - close:sender;
  90. - print:sender;
  91.  
  92. - saveIfNeeded;
  93.  
  94. - setManager:aManager;
  95. - manager;
  96. - setFile:(const char *)fName;
  97. - (BOOL)isUntitled;
  98. - (const char *)file;
  99. - docName;
  100.  
  101. - resetWindowTitle;
  102. - setDirty:(BOOL)flag;
  103. - (BOOL)isDirty;
  104.  
  105. - windowDidBecomeMain:sender;
  106. - windowDidResignMain:sender;
  107. - windowWillClose:sender;
  108.  
  109. - awake;
  110. - read:(NXTypedStream *)strm;
  111. - write:(NXTypedStream *)strm;
  112.  
  113. @end
  114.  
  115.